
# import matplotlib
# print(matplotlib.matplotlib_fname())



import numpy as np
import matplotlib.pyplot as plt

plt.rc('font',family='Times New Roman')

# Given data
# data = [1.7, 1.4, 1.1, 6.3, 1.7, 1.1, 1.1, 1.3, 1.4, 3.6,
#         1.2, 1.2, 1.8, 1.1, 0.976, 1.2, 0.984, 0.944, 0.904,
#         1.3, 1.4, 1.2, 1, 0.792, 1.2, 1.6, 1.3, 1, 1.6, 1.5]#720tr
# data = [1.6,2.0,1.9,1.8,0.432,1.1,1.9,1.6,1.5,2.0,2.5,1.8,1.7,2.0,2.1,2.0,3.0,1.8,2.0,1.8,2.0,3.0,1.8,2.9,1.9,2.0,1.9,2.2,1.9,3.6]#1080,tr
# data=[176,153,143,183,147,187,158,203,151,188,179,172,187,195,173,134,164,135,160,176,215,203,163,140,131,177,153,260,141,192]#1080,latency
data=[145,105,82,93,89,81,142,89,131,105,131,128,73,125,84,109,122,66,142,138,110,91,133,145,122,82,160,126,149,97]#720,latency
# Calculate the mean of the data
mean_value = np.mean(data)
# plt.rcParams['font.family'] = 'Times New Roman'

# Define x values from 1 to 30 with interval of 5
x_values = np.linspace(0, 29, len(data))

plt.figure(figsize=(10, 6))
plt.plot(x_values, data, color=(0, 0, 0.5), marker='', linestyle='-', linewidth=2)
plt.axhline(y=mean_value, color='orange', linestyle='--', linewidth=2)

# Set axis limits
plt.xlim(0, 30)  # Set x-axis limits from 0 to 30
plt.ylim(0, max(data) + 1)  # Set y-axis limits from 0 to max(data) + 1

# plt.grid(linestyle="--")  # 设置背景网格线为虚线
plt.grid(True)

plt.xticks(fontsize=24)
plt.yticks(fontsize=24)
# Show the 0 label on y-axis
plt.yticks(list(plt.yticks()[0]) + [0.0])
# Create the plot


# Show mean value on plot
plt.text(0, mean_value, f'', color='orange')

# Show the plot
plt.show()